{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1>Accessing <a href=\"http://www.uniprot.org/\">UniProt</a> Web Services from BioServices</h1>\n",
    "\n",
    "<p>This notebook illustrates some of the uniprot web services using BioServices uniprot module. We show how to </p>\n",
    "<ul>\n",
    "<li>Search for a known entry </li>\n",
    "<li>Search for a key word given an organism </li>\n",
    "<li>Retrieve i a dataframe information related to a list of known entries </li>\n",
    "<li>Perform a mapping between databases</li>\n",
    "<li>Fetch a FASTA sequence</li>\n",
    "</ul>\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    }
   ],
   "source": [
    "from bioservices import *\n",
    "%pylab inline --no-import-all"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### UniProt service can help us getting  information about a given protein"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "u = UniProt()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you already know the entry name, just type it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Entry\tEntry name\tStatus\tProtein names\tGene names\tOrganism\tLength\n",
      "P43403\tZAP70_HUMAN\treviewed\tTyrosine-protein kinase ZAP-70 (EC 2.7.10.2) (70 kDa zeta-chain associated protein) (Syk-related tyrosine kinase)\tZAP70 SRK\tHomo sapiens (Human)\t619\n",
      "\n"
     ]
    }
   ],
   "source": [
    "res = u.search(\"ZAP70_HUMAN\")\n",
    "print(res)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Otherwise, let us search the entire database. We can restrict the search to human species, and print results limited to 3 best matches and sub-selection of columns/information"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Entry name\tLength\tGene names\n",
      "ZAP70_HUMAN\t619\tZAP70 SRK\n",
      "CBL_HUMAN\t906\tCBL CBL2 RNF55\n",
      "LCK_HUMAN\t509\tLCK\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(u.search('zap70+AND+organism:9606', frmt='tab', limit=3,\n",
    "               columns=\"entry name, length, genes\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Entry\tEntry name\tStatus\tProtein names\tGene names\tOrganism\tLength\n",
      "P43403\tZAP70_HUMAN\treviewed\tTyrosine-protein kinase ZAP-70 (EC 2.7.10.2) (70 kDa zeta-chain associated protein) (Syk-related tyrosine kinase)\tZAP70 SRK\tHomo sapiens (Human)\t619\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(res)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Experimental: using pandas to scan the output of the search function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "u.debugLevel = \"INFO\"\n",
    "u.timeout = 10   # some queries are long and requires much more time; default is 1000 seconds\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Accession via entry name (e.g., ZAP70_HUMAN) is faster than by Entry (e.g., P43403)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Entry</th>\n",
       "      <th>Entry name</th>\n",
       "      <th>Gene names</th>\n",
       "      <th>Gene names  (primary )</th>\n",
       "      <th>Gene names  (synonym )</th>\n",
       "      <th>Gene names  (ordered locus )</th>\n",
       "      <th>Gene names  (ORF )</th>\n",
       "      <th>Organism</th>\n",
       "      <th>Organism ID</th>\n",
       "      <th>Protein names</th>\n",
       "      <th>...</th>\n",
       "      <th>Taxonomic lineage IDs (GENUS)</th>\n",
       "      <th>Taxonomic lineage IDs (SUBGENUS)</th>\n",
       "      <th>Taxonomic lineage IDs (SPECIES GROUP)</th>\n",
       "      <th>Taxonomic lineage IDs (SPECIES SUBGROUP)</th>\n",
       "      <th>Taxonomic lineage IDs (SPECIES)</th>\n",
       "      <th>Taxonomic lineage IDs (SUBSPECIES)</th>\n",
       "      <th>Taxonomic lineage IDs (VARIETAS)</th>\n",
       "      <th>Taxonomic lineage IDs (FORMA)</th>\n",
       "      <th>Cross-reference (db_abbrev)</th>\n",
       "      <th>Cross-reference (EMBL)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>P43403</td>\n",
       "      <td>ZAP70_HUMAN</td>\n",
       "      <td>[ZAP70 SRK]</td>\n",
       "      <td>ZAP70</td>\n",
       "      <td>SRK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Homo sapiens (Human)</td>\n",
       "      <td>9606</td>\n",
       "      <td>Tyrosine-protein kinase ZAP-70 (EC 2.7.10.2) (...</td>\n",
       "      <td>...</td>\n",
       "      <td>9605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>AB083211;AC016699;BC039039;BC053878;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Q8TD08</td>\n",
       "      <td>MK15_HUMAN</td>\n",
       "      <td>[MAPK15 ERK7 ERK8]</td>\n",
       "      <td>MAPK15</td>\n",
       "      <td>ERK7 ERK8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Homo sapiens (Human)</td>\n",
       "      <td>9606</td>\n",
       "      <td>Mitogen-activated protein kinase 15 (MAP kinas...</td>\n",
       "      <td>...</td>\n",
       "      <td>9605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>AY065978;AY994058;BC028034;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>P10144</td>\n",
       "      <td>GRAB_HUMAN</td>\n",
       "      <td>[GZMB CGL1 CSPB CTLA1 GRB]</td>\n",
       "      <td>GZMB</td>\n",
       "      <td>CGL1 CSPB CTLA1 GRB</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Homo sapiens (Human)</td>\n",
       "      <td>9606</td>\n",
       "      <td>Granzyme B (EC 3.4.21.79) (C11) (CTLA-1) (Cath...</td>\n",
       "      <td>...</td>\n",
       "      <td>9605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>M17016;J03189;J04071;J03072;M38193;M28879;BC03...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>P05412</td>\n",
       "      <td>JUN_HUMAN</td>\n",
       "      <td>[JUN]</td>\n",
       "      <td>JUN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Homo sapiens (Human)</td>\n",
       "      <td>9606</td>\n",
       "      <td>Transcription factor AP-1 (Activator protein 1...</td>\n",
       "      <td>...</td>\n",
       "      <td>9605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>J04111;CR541724;BT019759;AY217548;BC006175;BC0...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>4 rows × 179 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Entry   Entry name                  Gene names Gene names  (primary )  \\\n",
       "0  P43403  ZAP70_HUMAN                 [ZAP70 SRK]                  ZAP70   \n",
       "1  Q8TD08   MK15_HUMAN          [MAPK15 ERK7 ERK8]                 MAPK15   \n",
       "2  P10144   GRAB_HUMAN  [GZMB CGL1 CSPB CTLA1 GRB]                   GZMB   \n",
       "3  P05412    JUN_HUMAN                       [JUN]                    JUN   \n",
       "\n",
       "  Gene names  (synonym )  Gene names  (ordered locus )  Gene names  (ORF )  \\\n",
       "0                    SRK                           NaN                 NaN   \n",
       "1              ERK7 ERK8                           NaN                 NaN   \n",
       "2    CGL1 CSPB CTLA1 GRB                           NaN                 NaN   \n",
       "3                    NaN                           NaN                 NaN   \n",
       "\n",
       "               Organism  Organism ID  \\\n",
       "0  Homo sapiens (Human)         9606   \n",
       "1  Homo sapiens (Human)         9606   \n",
       "2  Homo sapiens (Human)         9606   \n",
       "3  Homo sapiens (Human)         9606   \n",
       "\n",
       "                                       Protein names  \\\n",
       "0  Tyrosine-protein kinase ZAP-70 (EC 2.7.10.2) (...   \n",
       "1  Mitogen-activated protein kinase 15 (MAP kinas...   \n",
       "2  Granzyme B (EC 3.4.21.79) (C11) (CTLA-1) (Cath...   \n",
       "3  Transcription factor AP-1 (Activator protein 1...   \n",
       "\n",
       "                         ...                          \\\n",
       "0                        ...                           \n",
       "1                        ...                           \n",
       "2                        ...                           \n",
       "3                        ...                           \n",
       "\n",
       "  Taxonomic lineage IDs (GENUS) Taxonomic lineage IDs (SUBGENUS)  \\\n",
       "0                          9605                              NaN   \n",
       "1                          9605                              NaN   \n",
       "2                          9605                              NaN   \n",
       "3                          9605                              NaN   \n",
       "\n",
       "   Taxonomic lineage IDs (SPECIES GROUP)  \\\n",
       "0                                    NaN   \n",
       "1                                    NaN   \n",
       "2                                    NaN   \n",
       "3                                    NaN   \n",
       "\n",
       "   Taxonomic lineage IDs (SPECIES SUBGROUP) Taxonomic lineage IDs (SPECIES)  \\\n",
       "0                                       NaN                             NaN   \n",
       "1                                       NaN                             NaN   \n",
       "2                                       NaN                             NaN   \n",
       "3                                       NaN                             NaN   \n",
       "\n",
       "   Taxonomic lineage IDs (SUBSPECIES) Taxonomic lineage IDs (VARIETAS)  \\\n",
       "0                                 NaN                              NaN   \n",
       "1                                 NaN                              NaN   \n",
       "2                                 NaN                              NaN   \n",
       "3                                 NaN                              NaN   \n",
       "\n",
       "   Taxonomic lineage IDs (FORMA) Cross-reference (db_abbrev)  \\\n",
       "0                            NaN                         NaN   \n",
       "1                            NaN                         NaN   \n",
       "2                            NaN                         NaN   \n",
       "3                            NaN                         NaN   \n",
       "\n",
       "                              Cross-reference (EMBL)  \n",
       "0               AB083211;AC016699;BC039039;BC053878;  \n",
       "1                        AY065978;AY994058;BC028034;  \n",
       "2  M17016;J03189;J04071;J03072;M38193;M28879;BC03...  \n",
       "3  J04111;CR541724;BT019759;AY217548;BC006175;BC0...  \n",
       "\n",
       "[4 rows x 179 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = u.get_df([\"ZAP70_HUMAN\", \"GRAB_HUMAN\", \"JUN_HUMAN\", \"MK15_HUMAN\"])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fc7a4874a58>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAErhJREFUeJzt3XuMXGd5x/Hvg52bsiEBDNvIdrFpTYsVoyTemqBUsAtp46RV3EoJchRCUxEstSS0Sih1RJXStFUFVUqFmoa63KGwhLSlVuIqIOJVL2pC4ubiOMFlCVazSYi5ut0QCC5P/5hjMxrvzs7OnJkdv/p+pJHPOfPOzPM+PufnmbOzx5GZSJLK8oKlLkCSVD/DXZIKZLhLUoEMd0kqkOEuSQUy3CWpQIa7JBXIcJekAhnuklSg5Uv1witWrMg1a9b0/DzPPvssp556au8F9ZE19m7Y6wNrrIs1trdnz55vZeZLFxyYmUty27hxY9Zh9+7dtTxPP1lj74a9vkxrrIs1tgfcnx1krKdlJKlAhrskFchwl6QCGe6SVCDDXZIKtGC4R8RHIuJgRDwyz/0RER+IiOmIeDgizq2/TEnSYnTyzv1jwOY2918ErKtu24Bbey9LktSLBcM9M/8F+E6bIVuAT1RfwbwHOCMizqyrQEnS4tVxzn0l8ETT+ky1TZK0RCI7+A+yI2INcEdmnjXHfXcCf5aZ/1atfwl4V2bumWPsNhqnbhgdHd04OTnZVdF7nzx0dHn0FHjmua6episbVp6+6MfMzs4yMjLS0+s2z7kf2vWxmznXrY4e9tvxXGO/9692WvevQfWxlzn3mju9HFMTExN7MnNsoXF1XFtmBljdtL4KeGqugZm5A9gBMDY2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vXmYeljVcWpEnHZkGfjlqqbmfrX2caB1zlfjsBzXmfkN4ImI+Llq0xuBRxmiHnZkUD+57eYG/CKNjzcPAw9Wt4uBTwJ7q+07gTObHvNuGue89wMXDaDGVwMPVLU8AtxYbX8FjR1wGvgccFK1/eRqfbq6/xVLWOPdVR8fAT7FT75REzT+g5avVfePDfjvfZyffBtlaPo4T31D1cOqXw9Vt33Au6vtLwG+BHy1+vPFS1VnmxqH6bg+G7i/quXzwIuGqYed3PwNVUkq0FCflpEkdcdwl6QCGe6SVCDDXZIKZLhLUoEMd0kqkOEuSQUy3CWpQP8P38eHtjZ84oUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fc7e70800f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df['Length'].hist()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### UniProt service can help us getting the FASTA sequence and more generally information about a given protein"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "sequence = u.retrieve(\"P43403\", \"fasta\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ">sp|P43403|ZAP70_HUMAN Tyrosine-protein kinase ZAP-70 OS=Homo sapiens OX=9606 GN=ZAP70 PE=1 SV=1\n",
      "MPDPAAHLPFFYGSISRAEAEEHLKLAGMADGLFLLRQCLRSLGGYVLSLVHDVRFHHFP\n",
      "IERQLNGTYAIAGGKAHCGPAELCEFYSRDPDGLPCNLRKPCNRPSGLEPQPGVFDCLRD\n",
      "AMVRDYVRQTWKLEGEALEQAIISQAPQVEKLIATTAHERMPWYHSSLTREEAERKLYSG\n",
      "AQTDGKFLLRPRKEQGTYALSLIYGKTVYHYLISQDKAGKYCIPEGTKFDTLWQLVEYLK\n",
      "LKADGLIYCLKEACPNSSASNASGAAAPTLPAHPSTLTHPQRRIDTLNSDGYTPEPARIT\n",
      "SPDKPRPMPMDTSVYESPYSDPEELKDKKLFLKRDNLLIADIELGCGNFGSVRQGVYRMR\n",
      "KKQIDVAIKVLKQGTEKADTEEMMREAQIMHQLDNPYIVRLIGVCQAEALMLVMEMAGGG\n",
      "PLHKFLVGKREEIPVSNVAELLHQVSMGMKYLEEKNFVHRDLAARNVLLVNRHYAKISDF\n",
      "GLSKALGADDSYYTARSAGKWPLKWYAPECINFRKFSSRSDVWSYGVTMWEALSYGQKPY\n",
      "KKMKGPEVMAFIEQGKRMECPPECPPELYALMSDCWIYKWEDRPDFLTVEQRMRACYYSL\n",
      "ASKVEGPPGSTQKAEAACA\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(sequence)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Alternatively, you can just use the following function to get the fasta sequence:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'MPDPAAHLPFFYGSISRAEAEEHLKLAGMADGLFLLRQCLRSLGGYVLSLVHDVRFHHFPIERQLNGTYAIAGGKAHCGPAELCEFYSRDPDGLPCNLRKPCNRPSGLEPQPGVFDCLRDAMVRDYVRQTWKLEGEALEQAIISQAPQVEKLIATTAHERMPWYHSSLTREEAERKLYSGAQTDGKFLLRPRKEQGTYALSLIYGKTVYHYLISQDKAGKYCIPEGTKFDTLWQLVEYLKLKADGLIYCLKEACPNSSASNASGAAAPTLPAHPSTLTHPQRRIDTLNSDGYTPEPARITSPDKPRPMPMDTSVYESPYSDPEELKDKKLFLKRDNLLIADIELGCGNFGSVRQGVYRMRKKQIDVAIKVLKQGTEKADTEEMMREAQIMHQLDNPYIVRLIGVCQAEALMLVMEMAGGGPLHKFLVGKREEIPVSNVAELLHQVSMGMKYLEEKNFVHRDLAARNVLLVNRHYAKISDFGLSKALGADDSYYTARSAGKWPLKWYAPECINFRKFSSRSDVWSYGVTMWEALSYGQKPYKKMKGPEVMAFIEQGKRMECPPECPPELYALMSDCWIYKWEDRPDFLTVEQRMRACYYSLASKVEGPPGSTQKAEAACA'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u.get_fasta_sequence(\"P43403\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### UniProt service has also a mapping utility that can be called via BioServices"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The are 3 parameters required. The input database code, the output database code and query as a list of valid identifiers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defaultdict(list, {'P43403': ['hsa:7535']})"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u.mapping(\"ACC\", \"KEGG_ID\", 'P43403')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defaultdict(list,\n",
       "            {'P43403': ['1FBV',\n",
       "              '1M61',\n",
       "              '1U59',\n",
       "              '2CBL',\n",
       "              '2OQ1',\n",
       "              '2OZO',\n",
       "              '2Y1N',\n",
       "              '3ZNI',\n",
       "              '4A4B',\n",
       "              '4A4C',\n",
       "              '4K2R',\n",
       "              '4XZ0',\n",
       "              '4XZ1',\n",
       "              '5O76']})"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u.mapping(\"ID\", \"PDB_ID\", \"P43403\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here are the databases available for mapping"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'AGD': 'AGD_ID',\n",
       " 'Aarhus/Ghent-2DPAGE': 'AARHUS_GHENT_2DPAGE_ID',\n",
       " 'Allergome': 'ALLERGOME_ID',\n",
       " 'ArachnoServer': 'ARACHNOSERVER_ID',\n",
       " 'BioCyc': 'BIOCYC_ID',\n",
       " 'CGD': 'CGD',\n",
       " 'CYGD': 'CYGD_ID',\n",
       " 'ChEMBL': 'CHEMBL_ID',\n",
       " 'ChiTaRS': 'CHITARS_ID',\n",
       " 'CleanEx': 'CLEANEX_ID',\n",
       " 'ConoServer': 'CONOSERVER_ID',\n",
       " 'DIP': 'DIP_ID',\n",
       " 'DMDM': 'DMDM_ID',\n",
       " 'DNASU': 'DNASU_ID',\n",
       " 'DisProt': 'DISPROT_ID',\n",
       " 'DrugBank': 'DRUGBANK_ID',\n",
       " 'EMBL/GenBank/DDBJ': 'EMBL_ID',\n",
       " 'EMBL/GenBank/DDBJ CDS': 'EMBL',\n",
       " 'EchoBASE': 'ECHOBASE_ID',\n",
       " 'EcoGene': 'ECOGENE_ID',\n",
       " 'Ensembl': 'ENSEMBL_ID',\n",
       " 'Ensembl Genomes': 'ENSEMBLGENOME_ID',\n",
       " 'Ensembl Genomes Protein': 'ENSEMBLGENOME_PRO_ID',\n",
       " 'Ensembl Genomes Transcript': 'ENSEMBLGENOME_TRS_ID',\n",
       " 'Ensembl Protein': 'ENSEMBL_PRO_ID',\n",
       " 'Ensembl Transcript': 'ENSEMBL_TRS_ID',\n",
       " 'Entrez Gene (GeneID)': 'P_ENTREZGENEID',\n",
       " 'EuPathDB': 'EUPATHDB_ID',\n",
       " 'FlyBase': 'FLYBASE_ID',\n",
       " 'GI number*': 'P_GI',\n",
       " 'GeneCards': 'GENECARDS_ID',\n",
       " 'GeneFarm': 'GENEFARM_ID',\n",
       " 'GeneID': 'P_ENTREZGENEID',\n",
       " 'GeneTree': 'GENETREE_ID',\n",
       " 'GenoList': 'GENOLIST_ID',\n",
       " 'GenomeRNAi': 'GENOMERNAI_ID',\n",
       " 'GenomeReviews': 'GENOMEREVIEWS_ID',\n",
       " 'GermOnline': 'GERMONLINE_ID',\n",
       " 'H-InvDB': 'H_INVDB_ID',\n",
       " 'HGNC': 'HGNC_ID',\n",
       " 'HOGENOM': 'HOGENOM_ID',\n",
       " 'HOVERGEN': 'HOVERGEN_ID',\n",
       " 'HPA': 'HPA_ID',\n",
       " 'HSSP': 'HSSP_ID',\n",
       " 'IPI': 'P_IPI',\n",
       " 'KEGG': 'KEGG_ID',\n",
       " 'KO': 'KO_ID',\n",
       " 'LegioList': 'LEGIOLIST_ID',\n",
       " 'Leproma': 'LEPROMA_ID',\n",
       " 'MEROPS': 'MEROPS_ID',\n",
       " 'MGI': 'MGI_ID',\n",
       " 'MIM': 'MIM_ID',\n",
       " 'MINT': 'MINT_ID',\n",
       " 'MaizeGDB': 'MAIZEGDB_ID',\n",
       " 'NextBio': 'NEXTBIO_ID',\n",
       " 'OMA': 'OMA_ID',\n",
       " 'Orphanet': 'ORPHANET_ID',\n",
       " 'OrthoDB': 'ORTHODB_ID',\n",
       " 'PATRIC': 'PATRIC_ID',\n",
       " 'PDB': 'PDB_ID',\n",
       " 'PIR': 'PIR',\n",
       " 'PeroxiBase': 'PEROXIBASE_ID',\n",
       " 'PharmGKB': 'PHARMGKB_ID',\n",
       " 'PhosSite': 'PHOSSITE_ID',\n",
       " 'PomBase': 'POMBASE_ID',\n",
       " 'PptaseDB': 'PPTASEDB_ID',\n",
       " 'ProtClustDB': 'PROTCLUSTDB_ID',\n",
       " 'PseudoCAP': 'PSEUDOCAP_ID',\n",
       " 'REBASE': 'REBASE_ID',\n",
       " 'RGD': 'RGD_ID',\n",
       " 'Reactome': 'REACTOME_ID',\n",
       " 'RefSeq Nucleotide': 'REFSEQ_NT_ID',\n",
       " 'RefSeq Protein': 'P_REFSEQ_AC',\n",
       " 'SGD': 'SGD_ID',\n",
       " 'TAIR': 'TAIR_ID',\n",
       " 'TCDB': 'TCDB_ID',\n",
       " 'TubercuList': 'TUBERCULIST_ID',\n",
       " 'UCSC': 'UCSC_ID',\n",
       " 'UniGene': 'UNIGENE_ID',\n",
       " 'UniParc': 'UPARC',\n",
       " 'UniPathWay': 'UNIPATHWAY_ID',\n",
       " 'UniProtKB': 'ID',\n",
       " 'UniProtKB AC/ID': 'ACC+ID',\n",
       " 'UniRef100': 'NF100',\n",
       " 'UniRef50': 'NF50',\n",
       " 'UniRef90': 'NF90',\n",
       " 'VectorBase': 'VECTORBASE_ID',\n",
       " 'World-2DPAGE': 'WORLD_2DPAGE_ID',\n",
       " 'WormBase': 'WORMBASE_ID',\n",
       " 'WormBase Protein': 'WORMBASE_PRO_ID',\n",
       " 'WormBase Transcript': 'WORMBASE_TRS_ID',\n",
       " 'Xenbase': 'XENBASE_ID',\n",
       " 'ZFIN': 'ZFIN_ID',\n",
       " 'dictyBase': 'DICTYBASE_ID',\n",
       " 'eggNOG': 'EGGNOG_ID',\n",
       " 'euHCVdb': 'EUHCVDB_ID',\n",
       " 'mycoCLAP': 'MYCOCLAP_ID',\n",
       " 'neXtProt': 'NEXTPROT_ID'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u._mapping"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Using get_df method to get exhaustive information"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--2020-03-10 18:05:59--  ftp://ftp.ebi.ac.uk/pub/databases/uniprot/knowledgebase/uniprot_sprot.fasta.gz\n",
      "           => ‘uniprot_sprot.fasta.gz’\n",
      "Resolving ftp.ebi.ac.uk (ftp.ebi.ac.uk)... 193.62.197.74\n",
      "Connecting to ftp.ebi.ac.uk (ftp.ebi.ac.uk)|193.62.197.74|:21... connected.\n",
      "Logging in as anonymous ... Logged in!\n",
      "==> SYST ... done.    ==> PWD ... done.\n",
      "==> TYPE I ... done.  ==> CWD (1) /pub/databases/uniprot/knowledgebase ... done.\n",
      "==> SIZE uniprot_sprot.fasta.gz ... 89133570\n",
      "==> PASV ... done.    ==> RETR uniprot_sprot.fasta.gz ... done.\n",
      "Length: 89133570 (85M) (unauthoritative)\n",
      "\n",
      "uniprot_sprot.fasta 100%[===================>]  85.00M  4.58MB/s    in 19s     \n",
      "\n",
      "2020-03-10 18:06:18 (4.41 MB/s) - ‘uniprot_sprot.fasta.gz’ saved [89133570]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "! wget ftp://ftp.ebi.ac.uk/pub/databases/uniprot/knowledgebase/uniprot_sprot.fasta.gz"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "!gunzip -c uniprot_sprot.fasta.gz | grep sp - | grep HUMAN | awk '{print substr($1, 12, length($1))}' > list.txt\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"list.txt\", \"r\") as fh:\n",
    "    identifiers = fh.read().split(\"\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO    [bioservices:UniProt]:  fetching information from uniprot for 1000 entries\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 1/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 2/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 3/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 4/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 5/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 6/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 7/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 8/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 9/10\n",
      "INFO    [bioservices:UniProt]:  uniprot.get_df 10/10\n"
     ]
    }
   ],
   "source": [
    "# This is slow. You may want to increase the attribute TIMEOUT or call this \n",
    "# command several times and aggregate the results\n",
    "u.TIMEOUT = 300\n",
    "####### limit set to 1 is important, otherwise this will take forever\n",
    "u.logging.level = \"INFO\"\n",
    "df = u.get_df(identifiers[0:1000], limit=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fc7a234df98>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAEp1JREFUeJzt3X+M5HV9x/Hnu3cHUhYP9Ox6Oc4uRNKUeK3ABjE0ZhZ/ARr5B5MjRMFqLrVabYsxhyYYTYzaRK0GI14rFY1lsaDtlbuGEmT98YfoLh7cHSdy2GtYoJ6CHi6i9uq7f8yXdnbYY2Znv7O7M5/nI5ns9/v5fuY77/fN7Gu/+92Z70VmIkkafr+z0gVIkpaHgS9JhTDwJakQBr4kFcLAl6RCGPiSVAgDX5IKYeBLUiEMfEkqxNqVeuANGzbk2NjYvLEnn3ySE088cWUK6iP7GjzD2tuw9gXD21t7XzMzMz/NzBf0sq8VC/yxsTGmp6fnjU1NTdFoNFamoD6yr8EzrL0Na18wvL219xUR/9nrvjylI0mFMPAlqRAGviQVwsCXpEIY+JJUiI6BHxHPiYjvRsQ9EbE/Ij64wJzjI+KmiDgYEXdFxFg/ipUk9a6bI/xfAxdk5h8DLwUujIjz2ua8FfhZZr4Y+CTwsXrLlCQtVcfAz6a5anVddWv/fxEvAW6olm8GXhkRUVuVkqQl6+ocfkSsiYg9wGHg9sy8q23KJuAhgMw8ChwBnl9noZKkpYnF/CfmEXEy8DXgL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+IiJOr5ROAVwEHgDtpXg4EntnXQpcL2Qlsrd7tchpwBvDd5enimTLz6sw8NTPHaH7vfD0zL2fA+wKIiBMj4qSnl2m+hvYx4K/FzPwv4KGI+INq6JXAfSxHXyv9R5nqjw0X03w3yIPA+1e6ni5rvhF4FPhvmj9p30rzXOgdwAPV1+dVc4PmfyLzILAXGG/Zz58CB6vbW1ZBX39C89fCe4E91e3iQe8N+CPg+1Vf+4BrqvHTaQbbQeCfgOOr8edU6wer7ae37Ov9Vb/3Axet9HPWUleD/3+XzsD3VfVwT3Xb/3Q2DPprsarnpcB09Xr8Z5rvsul7X37SVpIKsRpO6UiSloGBL0mFMPAlqRAGviQVwsCXpEIY+JJUCANfkgph4EtSIf4XltToLfX3WI0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fc7a27e3748>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df.Length.hist(bins=20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr>\n",
    "For more information, please see <a href=\"http://pythonhosted.org//bioservices/references.html?bioservices.uniprot.UniProt#module-bioservices.uniprot\">bioservices.uniprot module documentation.</a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
